<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <img
      class="outline-parent-bg"
      v-if="props.info.value"
      :src="publicUrls + 'free/style13/Level1outlineStyle4Bg.webp'"
      alt=""
    />
    <img v-else class="outline-parent-bg" :src="publicUrls + 'free/style13/Level1outlineStyle4Bg2.webp'" alt="" />

    <div class="outline jy-style-height">
      <div
        class="Showroom-parent"
        :class="!props.info.remarks && !props.info.subTitle && 'Showroom'"
        :id="route.meta.loopType && 'Showroom-padding'"
        v-if="props.info.digitalShowroom"
      >
        <digitalShowroomInfo :url="props.info.digitalShowroom" :id="props.info.id" />
      </div>
      <div class="content">
        <div class="content-tiitle">
          <div class="outline-text1" v-if="props.info.text.length >= 8">
            {{ props.info.text.slice(0, -4) }}
          </div>
          <div class="outline-text1" v-if="props.info.text.length >= 5 && props.info.text.length <= 7">
            {{ props.info.text.slice(0, -2) }}
          </div>
          <div
            class="outline-text"
            :class="props.info.text.length <= 4 && 'outline-right'"
            v-if="props.info.text.length >= 8"
          >
            <p v-for="item in props.info.text.slice(-4)" :key="item">{{ item }}</p>
          </div>
          <div
            class="outline-text"
            :class="props.info.text.length <= 4 && 'outline-right'"
            v-if="props.info.text.length >= 5 && props.info.text.length <= 7"
          >
            <p v-for="item in props.info.text.slice(-2)" :key="item">{{ item }}</p>
          </div>
          <div
            class="outline-text"
            :class="props.info.text.length <= 4 && 'outline-right'"
            v-if="props.info.text.length <= 4"
          >
            <p v-for="item in props.info.text.slice(-4)" :key="item">{{ item }}</p>
          </div>
        </div>
      </div>
      <div class="outline-content">
        <p class="outline-subTitle" v-if="props.info.subTitle">
          {{ props.info.subTitle }}
        </p>
        <TextMax
          :data="props.info.remarks"
          :infoData="props.info"
          :title="props.info.text"
          :row="props.info.subTitle ? 4 : 6"
        ></TextMax>
      </div>
      <div
        class="cover"
        v-if="props.info.value"
        @click="ImgVisible = true"
        @mouseenter="flag = true"
        @mouseleave="flag = false"
      ></div>
    </div>
    <div class="cover" :class="flag && 'outline-content-hover'" v-if="props.info.value">
      <img class="outline-cover" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
    </div>
    <img class="shadow" :src="publicUrls + 'free/style8/firstLevelOutline1Shadow.webp'" alt="" />
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free13Style4',
});
</script>

<script setup lang="ts">
import { publicUrls, textType } from '@/utils/minxin';
import { getTextHtml } from '@/utils/minxin';
import digitalShowroomInfo from '@/freeComponents/unitdigitalShowroom/style13.vue';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';
import { transform } from 'lodash';
import { useRoute } from 'vue-router';

const ImgVisible = ref(false);
const store = useProjectStore();
const flag = ref(false);
const route = useRoute();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style scoped lang="less">
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-top: 0;
  margin-left: 120px;

  .shadow {
    width: 406px;
    height: 200px;
    position: absolute;
    bottom: -30px;
    left: 210px;
  }
}
.Showroom-parent {
  position: absolute;
  top: 490px;
  left: 60px;
  z-index: 23;
}
#Showroom-padding {
  top: 520px !important;
}
.Showroom {
  left: auto;
  top: 540px;
  right: 60px;
}
.outline-parent-bg {
  width: 526px;
  height: 100%;
  position: relative;
  z-index: 20;
}
.outline {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  padding: 60px 60px 0 50px;
}
.content {
  width: 100%;
  min-height: 480px;
  margin-bottom: 42px;
}
.content-tiitle {
  width: 100%;
  position: relative;
  margin-bottom: 40px;
  display: flex;
  justify-content: end;
  .outline-text1 {
    font-family: SourceHanSerifCN-Bold;
    font-size: 32px;
    color: #333333;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 5px;
    line-height: 40px;
  }
  .outline-right {
    right: 0 !important;
  }
  .outline-text {
    width: 116px;
    position: absolute;
    top: 80px;
    right: 30px;
    ::v-deep p {
      font-family: Slidexiaxing;
      font-size: 96px;
      color: #333333;
      line-height: 88px;
      &:nth-child(odd) {
        margin-left: -13px;
      }
      &:nth-child(even) {
        margin-left: 6px;
      }
    }
  }
}

.outline-content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  .outline-subTitle {
    color: #000000;
    text-align: center;
    font-family: 'SourceHanSerifCN';
    font-size: 18px;
    line-height: 28px;
    margin-bottom: 16px;
    opacity: 0.8;
  }
}
.outline-content-hover {
  img {
    transform: scale(1.5);
  }
}
.cover {
  width: 296px;
  height: 480px;
  overflow: hidden;
  position: absolute;
  top: 60px;
  left: 0;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
  }
}

// ::v-deep .textMore-box {
//   height: 160px;
//   display: flex;
//   align-items: end;
// }
::v-deep .van-text-ellipsis {
  font-family: PingFangSC !important;
  font-size: 16px !important;
  color: rgba(0, 0, 0, 0.6) !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #ff0505 !important;
  font-weight: 400 !important;
  text-decoration-line: underline;
}
</style>